package com.hpin.mlxteacher.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.hpin.mlxteacher.R;

/**
 * RecyclerView 的 adapter
 * Created by Aaron on 15/7/29.
 */
public class ChildChooseAdapter extends RecyclerView.Adapter<ChildChooseAdapter.ViewHolder> {

    private Context ctx;

    public ChildChooseAdapter(Context ctx) {
        this.ctx = ctx;
    }


    //创建新View，被LayoutManager所调用
    @Override
    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {

        View view = View.inflate(ctx, R.layout.item_choose_child, null);
        ViewHolder vh = new ViewHolder(view);

        return vh;
    }

    //将数据与界面进行绑定的操作
    @Override
    public void onBindViewHolder(ViewHolder viewHolder, int i) {
        viewHolder.tv_title_name.setText("李大大   2018-9-10   23:12:23");
    }

    //获取数据的数量
    @Override
    public int getItemCount() {
        return 10;
    }

    //自定义的ViewHolder，持有每个Item的的所有界面元素
    public class ViewHolder extends RecyclerView.ViewHolder {
        public TextView tv_title_name;

        public ViewHolder(View itemView) {
            super(itemView);

            tv_title_name = (TextView) itemView.findViewById(R.id.tv_title_name);
        }
    }


}
